home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / contrib / germbib / bst / gerapali.bst < prev    next >
Text File  |  1993-04-20  |  28KB  |  1,228 lines

  1. % BibTeX `apalike' bibliography style (24-Jan-88 version)
  2. % Adapted from the `alpha' style, version 0.99a; for BibTeX version 0.99a.
  3. % Copyright (C) 1988, all rights reserved.
  4. % Copying of this file is allowed, provided that if you make any changes at all
  5. % you name it something other than `apalike.bst'.
  6. % This restriction helps ensure that all copies are identical.
  7. % Differences between this style and `alpha' are generally heralded by a `%'.
  8. % The file btxbst.doc has the documentation for alpha.bst.
  9. %
  10. % This style should be used with the `apalike' LaTeX style (apalike.sty).
  11. % \cite's come out like "(Jones, 1986)" in the text but there are no labels
  12. % in the bibliography, and something like "(1986)" comes out immediately
  13. % after the author.  Author (and editor) names appear as last name, comma,
  14. % initials.  A `year' field is required for every entry, and so is either
  15. % an author (or in some cases, an editor) field or a key field.
  16. %
  17. % Editorial note:
  18. % Many journals require a style like `apalike', but I strongly, strongly,
  19. % strongly recommend that you not use it if you have a choice---use something
  20. % like `plain' instead.  Mary-Claire van Leunen (A Handbook for Scholars,
  21. % Knopf, 1979) argues convincingly that a style like `plain' encourages better
  22. % writing than one like `apalike'.  Furthermore the strongest arguments for
  23. % using an author-date style like `apalike'---that it's "the most practical"
  24. % (The Chicago Manual of Style, University of Chicago Press, thirteenth
  25. % edition, 1982, pages 400--401)---fall flat on their face with the new
  26. % computer-typesetting technology.  For instance page 401 anachronistically
  27. % states "The chief disadvantage of [a style like `plain'] is that additions
  28. % or deletions cannot be made after the manuscript is typed without changing
  29. % numbers in both text references and list."  LaTeX sidesteps the disadvantage.
  30. %
  31. % History:
  32. %   15-sep-86   (SK,OP) Original version, by Susan King and Oren Patashnik.
  33. %   10-nov-86   (OP)    Truncated the sort.key$ string to the correct length
  34. %                       in bib.sort.order to eliminate error message.
  35. %   24-jan-88   (OP)    Updated for BibTeX version 0.99a, from alpha.bst 0.99a;
  36. %                       apalike now sorts by author, then year, then title;
  37. %                       THIS `apalike' VERSION DOES NOT WORK WITH BIBTEX 0.98i.
  38. %   15-feb-92   (MW)    Updated for use with `bibgerman.sty': things like "and"
  39. %                       change with the language. Switch the language using the
  40. %                       language field: 
  41. %                          language = "german" | "USenglish" | "english"
  42. %                       Then a `\selectlanguage{...}' command will be pushed just
  43. %                       before the `\bibitem...' command for the entry in work.
  44.  
  45. ENTRY
  46.   { address
  47.     author
  48.     booktitle
  49.     chapter
  50.     citelabel
  51.     edition
  52.     editor
  53.     howpublished
  54.     institution
  55.     journal
  56.     key
  57.     language
  58. %    month              not used in apalike
  59.     note
  60.     number
  61.     organization
  62.     pages
  63.     publisher
  64.     school
  65.     series
  66.     title
  67.     type
  68.     volume
  69.     year
  70.   }
  71.   {}
  72.   { label extra.label sort.label }
  73.  
  74. INTEGERS { output.state before.all mid.sentence after.sentence after.block before.title }
  75.  
  76. STRINGS { s t language.state language.temp }
  77.  
  78. FUNCTION {init.state.consts}
  79. { #0 'before.all :=
  80.   #1 'mid.sentence :=
  81.   #2 'after.sentence :=
  82.   #3 'after.block :=
  83.   #4 'before.title :=
  84.   "nostate" 'language.state :=
  85. }
  86.  
  87. FUNCTION {language.state.test}
  88.   'language.temp :=
  89.   language.temp language.state =
  90.     { #1 }
  91.     { #0 }
  92.   if$
  93. }
  94.  
  95. FUNCTION {output.nonnull}
  96. { 's :=
  97.   output.state mid.sentence =
  98.     { ", " * write$ }
  99.     { output.state after.block =
  100.         { add.period$ write$
  101.           newline$
  102.           "\newblock " write$
  103.         }
  104.         { output.state before.all =
  105.             'write$
  106.             % next if is for use with `new' FUNCTION {after.authors}
  107.             { output.state before.title =
  108.                 { ": " * write$ }
  109.                 { add.period$ " " * write$ }
  110.               if$
  111.             }
  112.           if$
  113.         }
  114.       if$
  115.       mid.sentence 'output.state :=
  116.     }
  117.   if$
  118.   s
  119. }
  120.  
  121. FUNCTION {output}
  122. { duplicate$ empty$
  123.     'pop$
  124.     'output.nonnull
  125.   if$
  126. }
  127.  
  128. FUNCTION {output.check}
  129. { 't :=
  130.   duplicate$ empty$
  131.     { pop$ "empty " t * " in " * cite$ * warning$ }
  132.     'output.nonnull
  133.   if$
  134. }
  135.  
  136. %                                       apalike needs this function because
  137. %                                       the year has special punctuation;
  138. %                                       apalike ignores the month
  139. FUNCTION {output.year.check}
  140. { year empty$
  141.     { "empty year in " cite$ * warning$ }
  142.     { write$
  143.       "\ (" year * extra.label * ")" *
  144.       mid.sentence 'output.state :=
  145.     }
  146.   if$
  147. }
  148.  
  149. FUNCTION {output.bibitem}
  150. { newline$
  151.   language empty$
  152.     'skip$
  153.     { language.state language =
  154.         'skip$
  155.         { "\selectlanguage{\" language * "}" * write$
  156.           newline$
  157.         }
  158.       if$
  159.       language 'language.state :=
  160.     }
  161.   if$
  162.   "\bibitem[" write$
  163.   label write$
  164.   "]{" write$
  165.   cite$ write$
  166.   "}" write$
  167.   newline$
  168.   ""
  169.   before.all 'output.state :=
  170. }
  171.  
  172. FUNCTION {fin.entry}
  173. { add.period$
  174.   write$
  175.   newline$
  176. }
  177.  
  178. FUNCTION {new.block}
  179. { output.state before.all =
  180.     'skip$
  181.     { after.block 'output.state := }
  182.   if$
  183. }
  184.  
  185. % new one -> sets what is specified in FUNCTION {output.nonnull}
  186. % if `before.title 'output.state = ... if$' is true
  187. % FUNCTION {after.authors}
  188. % { output.state before.all =
  189. %     'skip$
  190. %     { before.title 'output.state := }
  191. %   if$
  192. % }
  193.  
  194. % original -> sets points after (year) and before title
  195. FUNCTION {after.authors}
  196. { new.block }
  197.  
  198. FUNCTION {new.sentence}
  199. { output.state after.block =
  200.     'skip$
  201.     { output.state before.all =
  202.         'skip$
  203.         { after.sentence 'output.state := }
  204.       if$
  205.     }
  206.   if$
  207. }
  208.  
  209. FUNCTION {not}
  210. {   { #0 }
  211.     { #1 }
  212.   if$
  213. }
  214.  
  215. FUNCTION {and}
  216. {   'skip$
  217.     { pop$ #0 }
  218.   if$
  219. }
  220.  
  221. FUNCTION {or}
  222. {   { pop$ #1 }
  223.     'skip$
  224.   if$
  225. }
  226.  
  227. FUNCTION {new.block.checkb}
  228. { empty$
  229.   swap$ empty$
  230.   and
  231.     'skip$
  232.     'new.block
  233.   if$
  234. }
  235.  
  236. FUNCTION {field.or.null}
  237. { duplicate$ empty$
  238.     { pop$ "" }
  239.     'skip$
  240.   if$
  241. }
  242.  
  243. FUNCTION {emphasize}
  244. { duplicate$ empty$
  245.     { pop$ "" }
  246.     { "{\em " swap$ * "\/}" * }
  247.   if$
  248. }
  249.  
  250. FUNCTION {smallcaps}
  251. { duplicate$ empty$
  252.     { pop$ "" }
  253.     { "{\sc " swap$ * "}" * }
  254.   if$
  255. }
  256.  
  257. INTEGERS { nameptr namesleft numnames }
  258.  
  259. FUNCTION {format.names}
  260. { 's :=
  261.   #1 'nameptr :=
  262.   s num.names$ 'numnames :=
  263.   numnames 'namesleft :=
  264.     { namesleft #0 > }
  265.     { nameptr #1 >
  266.         { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't :=   % last name first
  267.           namesleft #1 >
  268.             { ", " * t smallcaps * }
  269.             { numnames #2 >
  270.                 { "english" language.state.test
  271.                   "USenglish" language.state.test
  272.                   or
  273.                      {"," * }
  274.                      'skip$
  275.                   if$
  276.                 }
  277.                 'skip$
  278.               if$
  279.               t "others" =
  280.                 { " \btxetalshort{.}" * }
  281.                 { " \btxandshort{.}\ " * t smallcaps * }
  282.               if$
  283.             }
  284.           if$
  285.         }
  286.         { s nameptr "{ll}{, jj}{, ff}{~vv}" format.name$ smallcaps } % last name first
  287.       if$
  288.       nameptr #1 + 'nameptr :=
  289.       namesleft #1 - 'namesleft :=
  290.     }
  291.   while$
  292. }
  293.  
  294. FUNCTION {format.authors}
  295. { author empty$
  296.     { "" }
  297.     { author format.names }
  298.   if$
  299. }
  300.  
  301. FUNCTION {format.key}                   % this function is just for apalike
  302. { empty$
  303.     { key field.or.null 
  304.       duplicate$ empty$
  305.          'skip$
  306.          { smallcaps }
  307.       if$
  308.     }
  309.     { "" }
  310.   if$
  311. }
  312.  
  313. FUNCTION {format.editors}
  314. { editor empty$
  315.     { "" }
  316.     { editor format.names
  317.       editor num.names$ #1 >
  318.         { ", \btxeditorsshort{.}" * }
  319.         { ", \btxeditorshort{.}" * }
  320.       if$
  321.     }
  322.   if$
  323. }
  324.  
  325. FUNCTION {format.title}
  326. { title empty$
  327.     { "" }
  328.     { "english" language.state.test
  329.       "USenglish" language.state.test
  330.       or
  331.         { title "t" change.case$ emphasize }
  332.         { title emphasize }
  333.       if$
  334.     }
  335.   if$
  336. }
  337.  
  338. FUNCTION {n.dashify}
  339. { 't :=
  340.   ""
  341.     { t empty$ not }
  342.     { t #1 #1 substring$ "-" =
  343.         { t #1 #2 substring$ "--" = not
  344.             { "--" *
  345.               t #2 global.max$ substring$ 't :=
  346.             }
  347.             {   { t #1 #1 substring$ "-" = }
  348.                 { "-" *
  349.                   t #2 global.max$ substring$ 't :=
  350.                 }
  351.               while$
  352.             }
  353.           if$
  354.         }
  355.         { t #1 #1 substring$ *
  356.           t #2 global.max$ substring$ 't :=
  357.         }
  358.       if$
  359.     }
  360.   while$
  361. }
  362.  
  363. FUNCTION {format.btitle}
  364. { title emphasize
  365. }
  366.  
  367. FUNCTION {tie.or.space.connect}
  368. { duplicate$ text.length$ #3 <
  369.     { "~" }
  370.     { "\ " }
  371.   if$
  372.   swap$ * *
  373. }
  374.  
  375. FUNCTION {either.or.check}
  376. { empty$
  377.     'pop$
  378.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  379.   if$
  380. }
  381.  
  382. FUNCTION {format.bvolume}
  383. { volume empty$
  384.     { "" }
  385.     { output.state after.block =
  386.         { "\Btxvolumeshort{.}" }
  387.         { "\btxvolumeshort{.}" }
  388.       if$
  389.       volume tie.or.space.connect
  390.       series empty$
  391.         'skip$
  392.         { " \btxofseriesshort{.}\ " * series emphasize * }
  393.       if$
  394.       "volume and number" number either.or.check
  395.     }
  396.   if$
  397. }
  398.  
  399. FUNCTION {format.number.series}
  400. { volume empty$
  401.     { number empty$
  402.         { series field.or.null }
  403.         { output.state mid.sentence =
  404.             { "\btxnumbershort{.}" }
  405.             { "\Btxnumbershort{.}" }
  406.           if$
  407.           number tie.or.space.connect
  408.           series empty$
  409.             { "there's a number but no series in " cite$ * warning$ }
  410.             { " \btxinseriesshort{.}\ " * series emphasize * }
  411.           if$
  412.         }
  413.       if$
  414.     }
  415.     { "" }
  416.   if$
  417. }
  418.  
  419. FUNCTION {format.edition}
  420. { edition empty$
  421.     { "" }
  422.     { "english" language.state.test
  423.       "USenglish" language.state.test
  424.       or
  425.         { output.state mid.sentence =
  426.             { edition "l" change.case$ " \btxeditionshort{.}" * }
  427.             { edition "t" change.case$ " \btxeditionshort{.}" * }
  428.           if$
  429.         }
  430.         { edition " \btxeditionshort{.}" * }
  431.       if$
  432.     }
  433.   if$
  434. }
  435.  
  436. INTEGERS { multiresult }
  437.  
  438. FUNCTION {multi.page.check}
  439. { 't :=
  440.   #0 'multiresult :=
  441.     { multiresult not
  442.       t empty$ not
  443.       and
  444.     }
  445.     { t #1 #1 substring$
  446.       duplicate$ "-" =
  447.       swap$ duplicate$ "," =
  448.       swap$ "+" =
  449.       or or
  450.         { #1 'multiresult := }
  451.         { t #2 global.max$ substring$ 't := }
  452.       if$
  453.     }
  454.   while$
  455.   multiresult
  456. }
  457.  
  458. FUNCTION {format.pages}
  459. { pages empty$
  460.     { "" }
  461.     { pages multi.page.check
  462.         { "\btxpagesshort{.}" pages n.dashify tie.or.space.connect }
  463.         { "\btxpageshort{.}" pages tie.or.space.connect }
  464.       if$
  465.     }
  466.   if$
  467. }
  468.  
  469. FUNCTION {format.vol.num.pages}
  470. { volume field.or.null
  471.   number empty$
  472.     'skip$
  473.     { "(" number * ")" * *
  474.       volume empty$
  475.         { "there's a number but no volume in " cite$ * warning$ }
  476.         'skip$
  477.       if$
  478.     }
  479.   if$
  480.   pages empty$
  481.     'skip$
  482.     { duplicate$ empty$
  483.         { pop$ format.pages }
  484.         { ":" * pages n.dashify * }
  485.       if$
  486.     }
  487.   if$
  488. }
  489.  
  490. FUNCTION {format.chapter.pages}
  491. { chapter empty$
  492.     'format.pages
  493.     { type empty$
  494.         { "\btxchaptershort{.}" }
  495.         { "english" language.state.test
  496.           "USenglish" language.state.test
  497.           or
  498.              { type "l" change.case$ }
  499.              { type }
  500.           if$
  501.         }
  502.       if$
  503.       chapter tie.or.space.connect
  504.       pages empty$
  505.         'skip$
  506.         { ", " * format.pages * }
  507.       if$
  508.     }
  509.   if$
  510. }
  511.  
  512. FUNCTION {format.in.ed.booktitle}
  513. { booktitle empty$
  514.     { "" }
  515.     { editor empty$
  516.         { "\Btxinshort{.}\ " booktitle emphasize * }
  517.         { "\Btxinshort{.}\ " format.editors * ": " * booktitle emphasize * }
  518.       if$
  519.     }
  520.   if$
  521. }
  522.  
  523. FUNCTION {format.thesis.type}
  524. { type empty$
  525.     'skip$
  526.     { pop$
  527.       "english" language.state.test
  528.       "USenglish" language.state.test
  529.       or
  530.         { type "t" change.case$ }
  531.         { type }
  532.       if$
  533.     }
  534.   if$
  535. }
  536.  
  537. FUNCTION {format.tr.number}
  538. { type empty$
  539.     { "\Btxtechreplong{.}" }
  540.     'type
  541.   if$
  542.   number empty$
  543.     { "english" language.state.test
  544.       "USenglish" language.state.test
  545.       or
  546.         { type empty$
  547.             { pop$ "\btxtechreplong{.}" }
  548.             { "t" change.case$ }
  549.           if$
  550.         }
  551.         'skip$
  552.       if$
  553.     }
  554.     { number tie.or.space.connect }
  555.   if$
  556. }
  557.  
  558. FUNCTION {format.article.crossref}
  559. { "In"                                                  % this is for apalike
  560.   " \cite{" * crossref * "}" *
  561. }
  562.  
  563. FUNCTION {format.book.crossref}
  564. { volume empty$
  565.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  566.       "\Btxinshort{.}\ "
  567.     }
  568.     { "\Btxvolumeshort{.}" volume tie.or.space.connect
  569.       " \btxofseriesshort{.}\ " * 
  570.     }
  571.   if$
  572.   "\cite{" * crossref * "}" *                           % this is for apalike
  573. }
  574.  
  575. FUNCTION {format.incoll.inproc.crossref}
  576. { "\Btxinshort{.}\ "                                                  % this is for apalike
  577.   "\cite{" * crossref * "}" *
  578. }
  579.  
  580. FUNCTION {article}
  581. { output.bibitem
  582.   format.authors "author" output.check
  583.   author format.key output                              % special for
  584.   output.year.check                                     % apalike
  585.   after.authors
  586.   format.title "title" output.check
  587.   new.block
  588.   crossref missing$
  589.     { journal
  590.       title missing$
  591.         { emphasize }
  592.         'skip$
  593.       if$
  594.       "journal" output.check 
  595.       format.vol.num.pages output
  596.     }
  597.     { format.article.crossref output.nonnull
  598.       format.pages output
  599.     }
  600.   if$
  601.   new.block
  602.   note output
  603.   fin.entry
  604. }
  605.  
  606. FUNCTION {book}
  607. { output.bibitem
  608.   author empty$
  609.     { format.editors "author and editor" output.check
  610.       editor format.key output
  611.     }
  612.     { format.authors output.nonnull
  613.       crossref missing$
  614.         { "author and editor" editor either.or.check }
  615.         'skip$
  616.       if$
  617.     }
  618.   if$
  619.   output.year.check                             % special for apalike
  620.   after.authors
  621.   format.btitle "title" output.check
  622.   crossref missing$
  623.     { format.bvolume output
  624.       new.block
  625.       format.number.series output
  626.       new.sentence
  627.       publisher "publisher" output.check
  628.       address output
  629.     }
  630.     { new.block
  631.       format.book.crossref output.nonnull
  632.     }
  633.   if$
  634.   format.edition output
  635.   new.block
  636.   note output
  637.   fin.entry
  638. }
  639.  
  640. FUNCTION {booklet}
  641. { output.bibitem
  642.   format.authors output
  643.   author format.key output                              % special for
  644.   output.year.check                                     % apalike
  645.   after.authors
  646.   format.title "title" output.check
  647.   new.block
  648.   howpublished output
  649.   address output
  650.   new.block
  651.   note output
  652.   fin.entry
  653. }
  654.  
  655. FUNCTION {inbook}
  656. { output.bibitem
  657.   author empty$
  658.     { format.editors "author and editor" output.check
  659.       editor format.key output
  660.     }
  661.     { format.authors output.nonnull
  662.       crossref missing$
  663.         { "author and editor" editor either.or.check }
  664.         'skip$
  665.       if$
  666.     }
  667.   if$
  668.   output.year.check                             % special for apalike
  669.   after.authors
  670.   format.btitle "title" output.check
  671.   crossref missing$
  672.     { format.bvolume output
  673.       format.chapter.pages "chapter and pages" output.check
  674.       new.block
  675.       format.number.series output
  676.       new.sentence
  677.       publisher "publisher" output.check
  678.       address output
  679.     }
  680.     { format.chapter.pages "chapter and pages" output.check
  681.       new.block
  682.       format.book.crossref output.nonnull
  683.     }
  684.   if$
  685.   format.edition output
  686.   new.block
  687.   note output
  688.   fin.entry
  689. }
  690.  
  691. FUNCTION {incollection}
  692. { output.bibitem
  693.   format.authors "author" output.check
  694.   author format.key output                              % special for
  695.   output.year.check                                     % apalike
  696.   after.authors
  697.   format.title "title" output.check
  698.   new.block
  699.   crossref missing$
  700.     { format.in.ed.booktitle "booktitle" output.check
  701.       format.bvolume output
  702.       format.number.series output
  703.       format.chapter.pages output
  704.       new.sentence
  705.       publisher "publisher" output.check
  706.       address output
  707.       format.edition output
  708.     }
  709.     { format.incoll.inproc.crossref output.nonnull
  710.       format.chapter.pages output
  711.     }
  712.   if$
  713.   new.block
  714.   note output
  715.   fin.entry
  716. }
  717.  
  718. FUNCTION {inproceedings}
  719. { output.bibitem
  720.   format.authors "author" output.check
  721.   author format.key output                              % special for
  722.   output.year.check                                     % apalike
  723.   after.authors
  724.   format.title "title" output.check
  725.   new.block
  726.   crossref missing$
  727.     { format.in.ed.booktitle "booktitle" output.check
  728.       format.bvolume output
  729.       format.number.series output
  730.       format.pages output
  731.       address output                                    % for apalike
  732.       new.sentence                                      % there's no year
  733.       organization output                               % here so things
  734.       publisher output                                  % are simpler
  735.     }
  736.     { format.incoll.inproc.crossref output.nonnull
  737.       format.pages output
  738.     }
  739.   if$
  740.   new.block
  741.   note output
  742.   fin.entry
  743. }
  744.  
  745. FUNCTION {conference} { inproceedings }
  746.  
  747. FUNCTION {manual}
  748. { output.bibitem
  749.   format.authors output
  750.   author format.key output                              % special for
  751.   output.year.check                                     % apalike
  752.   after.authors
  753.   format.btitle "title" output.check
  754.   organization address new.block.checkb
  755.   organization output
  756.   address output
  757.   format.edition output
  758.   new.block
  759.   note output
  760.   fin.entry
  761. }
  762.  
  763. FUNCTION {mastersthesis}
  764. { output.bibitem
  765.   format.authors "author" output.check
  766.   author format.key output                              % special for
  767.   output.year.check                                     % apalike
  768.   after.authors
  769.   format.title "title" output.check
  770.   new.block
  771.   "\btxmastthesis{.}" format.thesis.type output.nonnull
  772.   school "school" output.check
  773.   address output
  774.   new.block
  775.   note output
  776.   fin.entry
  777. }
  778.  
  779. FUNCTION {misc}
  780. { output.bibitem
  781.   format.authors output
  782.   author format.key output                              % special for
  783.   output.year.check                                     % apalike
  784.   after.authors
  785.   format.title output
  786.   new.block
  787.   howpublished output
  788.   new.block
  789.   note output
  790.   fin.entry
  791. }
  792.  
  793. FUNCTION {phdthesis}
  794. { output.bibitem
  795.   format.authors "author" output.check
  796.   author format.key output                              % special for
  797.   output.year.check                                     % apalike
  798.   after.authors
  799.   format.btitle "title" output.check
  800.   new.block
  801.   "\btxphdthesis{.}" format.thesis.type output.nonnull
  802.   school "school" output.check
  803.   address output
  804.   new.block
  805.   note output
  806.   fin.entry
  807. }
  808.  
  809. FUNCTION {proceedings}
  810. { output.bibitem
  811.   format.editors output
  812.   editor format.key output                              % special for
  813.   output.year.check                                     % apalike
  814.   after.authors
  815.   format.btitle "title" output.check
  816.   format.bvolume output
  817.   format.number.series output
  818.   address output                                % for apalike
  819.   new.sentence                                  % we always output
  820.   organization output                           % a nonempty organization
  821.   publisher output                              % here
  822.   new.block
  823.   note output
  824.   fin.entry
  825. }
  826.  
  827. FUNCTION {techreport}
  828. { output.bibitem
  829.   format.authors "author" output.check
  830.   author format.key output                              % special for
  831.   output.year.check                                     % apalike
  832.   after.authors
  833.   format.title "title" output.check
  834.   new.block
  835.   format.tr.number output.nonnull
  836.   institution "institution" output.check
  837.   address output
  838.   new.block
  839.   note output
  840.   fin.entry
  841. }
  842.  
  843. FUNCTION {unpublished}
  844. { output.bibitem
  845.   format.authors "author" output.check
  846.   author format.key output                              % special for
  847.   output.year.check                                     % apalike
  848.   after.authors
  849.   format.title "title" output.check
  850.   new.block
  851.   note "note" output.check
  852.   fin.entry
  853. }
  854.  
  855. FUNCTION {default.type} { misc }
  856.  
  857. MACRO {jan} {"\btxmonjanshort{.}"}
  858.  
  859. MACRO {feb} {"\btxmonfebshort{.}"}
  860.  
  861. MACRO {mar} {"\btxmonmarshort{.}"}
  862.  
  863. MACRO {apr} {"\btxmonaprshort{.}"}
  864.  
  865. MACRO {may} {"\btxmonmayshort{.}"}
  866.  
  867. MACRO {jun} {"\btxmonjunshort{.}"}
  868.  
  869. MACRO {jul} {"\btxmonjulshort{.}"}
  870.  
  871. MACRO {aug} {"\btxmonaugshort{.}"}
  872.  
  873. MACRO {sep} {"\btxmonsepshort{.}"}
  874.  
  875. MACRO {oct} {"\btxmonoctshort{.}"}
  876.  
  877. MACRO {nov} {"\btxmonnovshort{.}"}
  878.  
  879. MACRO {dec} {"\btxmondecshort{.}"}
  880.  
  881. MACRO {acmcs} {"ACM Computing Surveys"}
  882.  
  883. MACRO {acta} {"Acta Informatica"}
  884.  
  885. MACRO {cacm} {"Communications of the ACM"}
  886.  
  887. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  888.  
  889. MACRO {ibmsj} {"IBM Systems Journal"}
  890.  
  891. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  892.  
  893. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  894.  
  895. MACRO {ieeetcad}
  896.  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  897.  
  898. MACRO {ipl} {"Information Processing Letters"}
  899.  
  900. MACRO {jacm} {"Journal of the ACM"}
  901.  
  902. MACRO {jcss} {"Journal of Computer and System Sciences"}
  903.  
  904. MACRO {scp} {"Science of Computer Programming"}
  905.  
  906. MACRO {sicomp} {"SIAM Journal on Computing"}
  907.  
  908. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  909.  
  910. MACRO {tods} {"ACM Transactions on Database Systems"}
  911.  
  912. MACRO {tog} {"ACM Transactions on Graphics"}
  913.  
  914. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  915.  
  916. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  917.  
  918. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  919.  
  920. MACRO {tcs} {"Theoretical Computer Science"}
  921.  
  922. READ
  923.  
  924. FUNCTION {sortify}
  925. { purify$
  926.   "l" change.case$
  927. }
  928.  
  929. INTEGERS { len }
  930.  
  931. FUNCTION {chop.word}
  932. { 's :=
  933.   'len :=
  934.   s #1 len substring$ =
  935.     { s len #1 + global.max$ substring$ }
  936.     's
  937.   if$
  938. }
  939.  
  940. %                       There are three apalike cases: one person (Jones),
  941. %                       two (Jones and de~Bruijn), and more (Jones et~al.).
  942. %                       This function is much like format.crossref.editors.
  943. %
  944. FUNCTION {format.lab.names}
  945. { 's :=
  946.   s #1 "{vv~}{ll}" format.name$ smallcaps
  947.   s num.names$ duplicate$
  948.   #2 >
  949.     { pop$ " \btxetalshort{.}" * }
  950.     { #2 <
  951.         'skip$
  952.         { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  953.             { " \btxetalshort{.}" * }
  954.             { " \btxandshort{.}\ " * s #2 "{vv~}{ll}" format.name$ smallcaps * }
  955.           if$
  956.         }
  957.       if$
  958.     }
  959.   if$
  960. }
  961.  
  962. FUNCTION {author.key.label}
  963. { citelabel empty$
  964.     { author empty$
  965.         { key empty$
  966.             { cite$ #1 #3 substring$ }
  967.             'key                                    % apalike uses the whole key
  968.           if$
  969.         }
  970.         { author format.lab.names }
  971.       if$
  972.     }
  973.     { citelabel smallcaps }
  974.   if$
  975. }
  976.  
  977. FUNCTION {author.editor.key.label}
  978. { citelabel empty$
  979.     { author empty$
  980.         { editor empty$
  981.             { key empty$
  982.                 { cite$ #1 #3 substring$ }
  983.                 'key                                % apalike uses the whole key
  984.               if$
  985.             }
  986.             { editor format.lab.names }
  987.           if$
  988.         }
  989.         { author format.lab.names }
  990.       if$
  991.     }
  992.     { citelabel smallcaps }
  993.   if$
  994. }
  995.  
  996. FUNCTION {editor.key.label}
  997. { citelabel empty$
  998.     { editor empty$
  999.        { key empty$
  1000.            { cite$ #1 #3 substring$ }
  1001.            'key                    % apalike uses the whole key, no organization
  1002.          if$
  1003.        }
  1004.        { editor format.lab.names }
  1005.      if$
  1006.     }
  1007.     { citelabel smallcaps }
  1008.   if$
  1009. }
  1010.  
  1011. FUNCTION {calc.label}
  1012. { type$ "book" =
  1013.   type$ "inbook" =
  1014.   or
  1015.     'author.editor.key.label
  1016.     { type$ "proceedings" =
  1017.         'editor.key.label                       % apalike ignores organization
  1018.         'author.key.label                       % for labeling and sorting
  1019.       if$
  1020.     }
  1021.   if$
  1022.   year empty$
  1023.     {""}
  1024. %    {", "} % original
  1025.      {" "}  % geändert für Andreas Diplomarbeit 30/04/92
  1026.   if$                                                   % these three lines are
  1027.   *                                                     % for apalike, which
  1028. %  year field.or.null purify$ #-1 #4 substring$          % uses all four digits % original
  1029.   year field.or.null % geändert für Andreas Diplomarbeit 19/09/92 um Jahresangaben wie 1988a, 1988b zu ermöglichen
  1030.   *
  1031.   'label :=
  1032. }
  1033.  
  1034. FUNCTION {sort.format.names}
  1035. { 's :=
  1036.   #1 'nameptr :=
  1037.   ""
  1038.   s num.names$ 'numnames :=
  1039.   numnames 'namesleft :=
  1040.     { namesleft #0 > }
  1041.     { nameptr #1 >
  1042.         { "   " * }
  1043.         'skip$
  1044.       if$                                               % apalike uses initials
  1045.       s nameptr "{ll{ }}{ ff{ }}{vv{ } }{  jj{ }}" format.name$ 't := % <= here
  1046.       nameptr numnames = t "others" = and
  1047.         { "et al" * }
  1048.         { t sortify * }
  1049.       if$
  1050.       nameptr #1 + 'nameptr :=
  1051.       namesleft #1 - 'namesleft :=
  1052.     }
  1053.   while$
  1054. }
  1055.  
  1056. FUNCTION {sort.format.title}
  1057. { 't :=
  1058.   "A " #2
  1059.     "An " #3
  1060.       "The " #4 t chop.word
  1061.     chop.word
  1062.   chop.word
  1063.   sortify
  1064.   #1 global.max$ substring$
  1065. }
  1066.  
  1067. FUNCTION {author.sort}
  1068. { author empty$
  1069.     { key empty$
  1070.         { "to sort, need author or key in " cite$ * warning$
  1071.           ""
  1072.         }
  1073.         { key sortify }
  1074.       if$
  1075.     }
  1076.     { author sort.format.names }
  1077.   if$
  1078. }
  1079.  
  1080. FUNCTION {author.editor.sort}
  1081. { author empty$
  1082.     { editor empty$
  1083.         { key empty$
  1084.             { "to sort, need author, editor, or key in " cite$ * warning$
  1085.               ""
  1086.             }
  1087.             { key sortify }
  1088.           if$
  1089.         }
  1090.         { editor sort.format.names }
  1091.       if$
  1092.     }
  1093.     { author sort.format.names }
  1094.   if$
  1095. }
  1096.  
  1097. FUNCTION {editor.sort}
  1098. { editor empty$
  1099.     { key empty$
  1100.         { "to sort, need editor or key in " cite$ * warning$
  1101.           ""
  1102.         }
  1103.         { key sortify }
  1104.       if$
  1105.     }
  1106.     { editor sort.format.names }
  1107.   if$
  1108. }
  1109.  
  1110. %                       apalike uses two sorting passes; the first one sets the
  1111. %                       labels so that the `a's, `b's, etc. can be computed;
  1112. %                       the second pass puts the references in "correct" order.
  1113. %                       The presort function is for the first pass. It computes
  1114. %                       label, sort.label, and title, and then concatenates.
  1115. FUNCTION {presort}
  1116. { calc.label
  1117.   label sortify
  1118.   "    "
  1119.   *
  1120.   type$ "book" =
  1121.   type$ "inbook" =
  1122.   or
  1123.     'author.editor.sort
  1124.     { type$ "proceedings" =
  1125.         'editor.sort
  1126.         'author.sort
  1127.       if$
  1128.     }
  1129.   if$
  1130.   #1 entry.max$ substring$      % for
  1131.   'sort.label :=                % apalike
  1132.   sort.label                    % style
  1133.   *
  1134.   "    "
  1135.   *
  1136.   title field.or.null
  1137.   sort.format.title
  1138.   *
  1139.   #1 entry.max$ substring$
  1140.   'sort.key$ :=
  1141. }
  1142.  
  1143. ITERATE {presort}
  1144.  
  1145. SORT            % by label, sort.label, title---for final label calculation
  1146.  
  1147. STRINGS { last.label next.extra }       % apalike labels are only for the text;
  1148.  
  1149. INTEGERS { last.extra.num }             % there are none in the bibliography
  1150.  
  1151. FUNCTION {initialize.extra.label.stuff} % and hence there is no `longest.label'
  1152. { #0 int.to.chr$ 'last.label :=
  1153.   "" 'next.extra :=
  1154.   #0 'last.extra.num :=
  1155. }
  1156.  
  1157. FUNCTION {forward.pass}
  1158. { last.label label =
  1159.     { last.extra.num #1 + 'last.extra.num :=
  1160.       last.extra.num int.to.chr$ 'extra.label :=
  1161.     }
  1162.     { "a" chr.to.int$ 'last.extra.num :=
  1163.       "" 'extra.label :=
  1164.       label 'last.label :=
  1165.     }
  1166.   if$
  1167. }
  1168.  
  1169. FUNCTION {reverse.pass}
  1170. { next.extra "b" =
  1171.     { "a" 'extra.label := }
  1172.     'skip$
  1173.   if$
  1174.   label extra.label * 'label :=
  1175.   extra.label 'next.extra :=
  1176. }
  1177.  
  1178. EXECUTE {initialize.extra.label.stuff}
  1179.  
  1180. ITERATE {forward.pass}
  1181.  
  1182. REVERSE {reverse.pass}
  1183.  
  1184. %                               Now that the label is right we sort for real,
  1185. %                               on sort.label then year then title.  This is
  1186. %                               for the second sorting pass.
  1187. FUNCTION {bib.sort.order}
  1188. { sort.label
  1189.   "    "
  1190.   *
  1191.   year field.or.null sortify
  1192.   *
  1193.   "    "
  1194.   *
  1195.   title field.or.null
  1196.   sort.format.title
  1197.   *
  1198.   #1 entry.max$ substring$
  1199.   'sort.key$ :=
  1200. }
  1201.  
  1202. ITERATE {bib.sort.order}
  1203.  
  1204. SORT            % by sort.label, year, title---giving final bibliography order
  1205.  
  1206. FUNCTION {begin.bib}
  1207. { preamble$ empty$                              % no \etalchar in apalike
  1208.     'skip$
  1209.     { preamble$ write$ newline$ }
  1210.   if$
  1211.   "\begin{thebibliography}{}" write$ newline$           % no labels in apalike
  1212. }
  1213.  
  1214. EXECUTE {begin.bib}
  1215.  
  1216. EXECUTE {init.state.consts}
  1217.  
  1218. ITERATE {call.type$}
  1219.  
  1220. FUNCTION {end.bib}
  1221. { newline$
  1222.   "\end{thebibliography}" write$ newline$
  1223. }
  1224.  
  1225. EXECUTE {end.bib}
  1226.  
  1227.